<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8"/>
    <title>派单详情</title>
    <link href="https://cdn.bootcss.com/twitter-bootstrap/3.0.1/css/bootstrap.min.css" rel="stylesheet">
    <script src="/static/js/jquery-1.8.3.min.js"></script>
    <script type="text/javascript">
        $(function () {
            var tagName = document.getElementsByTagName("li");
                for (var i = 0; i <tagName.length ; i++) {
                    // tagName[i].removeAttribute("class")
                    tagName[i].setAttribute('class','');
                }
            var tagli = document.getElementById("${li}");
                tagli.setAttribute('class','active')
        })
    </script>
</head>
<body>

<div class="container">
    <div class="row clearfix">
        <div class="col-md-12 column">
            <div class="list-group" class="col-md-12 column">
                <a href="#" class="list-group-item active">配送订单</a>
            </div>
            <div class="panel panel-warning" >
                <div class="panel-heading">
                    <h3 class="panel-title">
                        筛选查询
                    </h3>
                </div>
                <div class="panel-body">
                    <form method="get" action="/order/findsendlist">
                        <table>
                            <tr><td>
                                    订单编号： <input type="text" name="ordernum" value="${ordernum!''}" size="12" />&nbsp;&nbsp;&nbsp;
                                    订单来源：<input type="text" value="${source!''}" name="source" size="12" />&nbsp;&nbsp;&nbsp;
                                    客户名称：<input name="username" value="${username!''}" type="text" size="12"  />&nbsp;&nbsp;&nbsp;
                                    订单时间：<input type="date" value="${orderdate!''}" name="orderdate"  />&nbsp;&nbsp;&nbsp;
                                    <input type="submit" value="查找"/>
                                </td></tr>
                        </table>
                    </form>
                </div>

                <div class="tabbable" id="tabs-756792" align="center">
                    <ul class="nav nav-tabs" >
                        <li class="active"  style="width: 25%" id="li1">
                            <a href="/order/findsendlist?li=li1" data-toggle="tab">全部</a>
                        </li>
                        <li  style="width: 25%" id="li2">
                            <a href="/order/findsendlist?deliveryman=0&li=li2" data-toggle="tab">未指派</a>
                        </li>
                        <li style="width: 25%" id="li3">
                            <a href="/order/findsendlist?deliveryman=1&orderstate=2&orderstate=3&li=li3" data-toggle="tab">已指派</a>
                        </li>
                        <li  style="width: 25%" id="li4" >
                            <a href="/order/findsendlist?orderstate=4&li=li4" data-toggle="tab" >已完成</a>
                        </li>
                    </ul>
<#--                    <div class="tab-content">-->
<#--                        <div class="tab-pane" id="panel-460148">-->
<#--                            <p>-->
<#--                                I'm in Section 1.-->
<#--                            </p>-->
<#--                        </div>-->
<#--                        <div class="tab-pane active" id="panel-39365">-->
<#--                            <p>-->
<#--                                Howdy, I'm in Section 2.-->
<#--                            </p>-->
<#--                        </div>-->
<#--                    </div>-->
                </div>

<#--                <div class="panel-footer" >-->
<#--                    <ul class="nav nav-tabs">-->
<#--                        <li  class="col-md-3 column">-->
<#--                            <a href="/order/findsendlist" >全部</a>-->
<#--                        </li>-->
<#--                        <li  class="col-md-3 column">-->
<#--                            <a href="/order/findsendlist?deliveryman=0">未指派</a>-->
<#--                        </li>-->
<#--                        <li class="col-md-3 column">-->
<#--                            <a href="/order/findsendlist?deliveryman=1&orderstate=2&orderstate=3">已指派</a>-->
<#--                        </li>-->
<#--                        <li class="col-md-3 column">-->
<#--                            <a href="/order/findsendlist?orderstate=4">已完成</a>-->
<#--                        </li>-->
<#--                    </ul>-->
<#--                </div>-->
                <div class="panel-heading">
                    <h3 class="panel-title">
                        数据列表
                        <#if (empl.role.rName=="派单经理")>
                            <button type="button" onclick="sub()" style="float: right">指定配送人员</button>
                        </#if>
                    </h3>
                </div>
                <#if (pageInfo.list?size!=0)>
                <div class="panel-body">
                    <form action="/order/sendman" method="post">
                    <table class="table" width="100%">
                        <thead>
                        <tr>
                            <th><input type="checkbox" id="cb" onchange="cbc()"/></th>
                            <th>序号</th>
                            <th> 订单编号 </th>
                            <th> 商品名称 </th>
                            <th>单价</th>
                            <th> 数量</th>
                            <th>客户编码</th>
                            <th>客户名称</th>
                            <th>联系方式</th>
                            <th>实付金额</th>
                            <th>订单时间</th>
                            <th>送货员</th>
                            <th>订单形式</th>
                            <th>订单状态</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <#list pageInfo.list as order>
                            <tr class="info">
                                <td><#if (order.deliveryman=="0" && order.orderstate==2)><input type="checkbox" name="orderids" value="${order.orderid}" class="cbs"/></#if></td>
                                <td>${order_index+1}</td>
                                <td>${order.ordernum}</td>
                                <td>${order.commodity.commName}</td>
                                <td>${order.commodity.price}</td>
                                <td>${order.num}</td>
                                <td>${order.client.clientnum}</td>
                                <td>${order.client.username}</td>
                                <td>${order.client.phone}</td>
                                <td>${order.amountpaid}</td>
                                <td>${order.orderdate?date}</td>
                                <td><#if (order.deliveryman!="0")>${order.deliveryman!''}</#if></td>
                                <td>${order.shape}</td>
                                <td><#if (order.orderstate==2)>未发货</#if>
                                    <#if (order.orderstate==3)>已发货</#if>
                                    <#if (order.orderstate==4)>已完成</#if></td>
                                <td><a href="/order/onesend?orderid=${order.orderid}">查看</a></td>
                            </tr>
                        </#list>
                        <tr>
                            <td colspan="7" style="text-align: center">
                                <#--                    ordernum, String source, String orderdate, String username,-->
                                <#if (pageindex??)>
                                    <#if (pageindex>1)>
                                        <a href="/order/findsendlist?pageindex=1&ordernum=${ordernum!''}&source=${source!''}&orderdate=${orderdate!''}&username=${username!''}&state=${state!''}">首页</a>
                                        &nbsp;&nbsp;&nbsp;
                                        <a href="/order/findsendlist?pageindex=${pageInfo.prePage}&ordernum=${ordernum!''}&source=${source!''}&orderdate=${orderdate!''}&username=${username!''}&state=${state!''}">上一页</a>
                                    </#if>
                                </#if>
                                &nbsp;&nbsp;&nbsp;
                                <#if (pageindex??)>
                                    <#if (pageindex<pages)>
                                        <a href="/order/findsendlist?pageindex=${pageInfo.nextPage}&ordernum=${ordernum!''}&source=${source!''}&orderdate=${orderdate!''}&username=${username!''}&state=${state!''}">下一页</a>
                                        &nbsp;&nbsp;&nbsp;
                                        <a href="/order/findsendlist?pageindex=${pageInfo.pages}&ordernum=${ordernum!''}&source=${source!''}&orderdate=${orderdate!''}&username=${username!''}">尾页</a>
                                    </#if>
                                </#if>
                            </td>
                            <td colspan="8" style="text-align: center">
                                当前${pageInfo.pageNum} / ${pageInfo.pages}页 每页${pageInfo.pageSize}条
                            </td>
                        </tr>
                        </tbody>
                    </table>
                    </form>
                </div>
                <#else ><h1>抱歉暂无数据!</h1>
                </#if>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    function sub() {
        //提交表单
        var className = document.getElementsByClassName("cbs");
        for (var i = 0; i <className.length ; i++) {
           var cd= className[i].checked
            if (cd){
                break;
            }
            if (i==className.length-1){
                alert("请选择订单！");
                return;
            }
        }
        document.forms[1].submit();
    }
    function cbc() {
        var cb=document.getElementById("cb");
        var className = document.getElementsByClassName("cbs");
        var flag=cb.checked;
        for (var i = 0; i <className.length ; i++) {
            className[i].checked=flag;
        }
    }

    // function act(obj) {
    //     // alert("1")
    //     var tagName = document.getElementsByTagName("li");
    //     for (var i = 0; i <tagName.length ; i++) {
    //         // tagName[i].removeAttribute("class")
    //         tagName[i].setAttribute('class','');
    //     }
    //     // obj.setAttribute('class','active')
    //     obj.classList.add('active')/
    //     obj.addClass('active')
    // }
</script>
</body>
</html>